package com.bestv.bsr.core.constants;

import java.util.HashMap;
import java.util.Map;

/**
 * 推荐方式
 */
public enum RecommendMethod {

    COLLABORATIVE_FILTERING("cf", "协同用户过滤算法推荐"),
    ITEM_BASE("item_base", " 相关性推荐"),
    HOT_PLAY("hot_play", "热播推荐");

    private static final Map<String, RecommendMethod> map = new HashMap<>(5);

    static {
        for (RecommendMethod method : values()) {
            map.put(method.getCode(), method);
        }
    }

    private final String code;
    private final String desc;

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    RecommendMethod(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static RecommendMethod fromCode(String code) {
        return map.get(code);
    }
}
